home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / image / stview11.zip / STARVIEW.MEX < prev    next >
Text File  |  1996-06-21  |  3KB  |  137 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // StarView V1.0 (!)1996 Larry Monte/StarLab Systems SoftWare
  4. //
  5. //
  6.  
  7. #define INCL_starview
  8.  
  9. #include <max.mh>
  10. #include <starview.mh>
  11. #include <language.mh>
  12.  
  13. struct _ffind: ff;
  14.  
  15. char: nonstop;
  16.  
  17. void cleanup()                  // Clear out work dir
  18. {
  19.   if(filefindfirst(ff,STARVIEW_PATH+"temp"+this_task+"\\*.*",FA_NORMAL))
  20.   {
  21.     do
  22.     {
  23.       remove(STARVIEW_PATH+"temp"+this_task+"\\"+strupper(ff.filename));
  24.     }
  25.     while(filefindnext(ff));
  26.     filefindclose(ff);
  27.   }
  28. }
  29.  
  30. void do_unpack(string: fname, string: work_path)
  31. {
  32.   filecopy(farea.downpath+fname,work_path+"\\"+fname);
  33.  
  34. #ifdef DOS
  35.  
  36.   shell(IOUTSIDE_DOS|IOUTSIDE_REREAD,STARVIEW_PATH+"unpack.bat "+
  37.         work_path+" "+work_path+"\\"+fname);
  38.  
  39. #endif
  40. #ifdef OS2
  41.  
  42.   shell(IOUTSIDE_DOS|IOUTSIDE_REREAD,STARVIEW_PATH+"unpack.cmd "+
  43.         work_path+" "+work_path+"\\"+fname);
  44.  
  45. #endif
  46.  
  47. }
  48.  
  49.  
  50. int get_txt(string: fname, string: work_path)
  51. {
  52.   int: file_index, found, in_num, see_more;
  53.   string: in;
  54.   array [1..100] of string: arc_fname;
  55.  
  56.   file_index := 0;
  57.   reset_more(nonstop);
  58.  
  59.  
  60.   print(AVATAR_CLS,str_stv_file_hdr);
  61.   if(filefindfirst(ff,work_path+"\\*.*",FA_NORMAL))
  62.   {
  63.     do
  64.     {
  65.       found := do_spec(strupper(ff.filename));
  66.       if(found = 1)
  67.       {
  68.         file_index := file_index +1;
  69.         arc_fname[file_index] := strupper(ff.filename);
  70.         print(COL_LBLUE, file_index, "   -   "+COL_YELLOW+
  71.               strpad(arc_fname[file_index],14,' ')+
  72.               COL_GREEN+longpadleft(ff.filesize,9,' ')+"\n");
  73.       }
  74.     }
  75.     while(filefindnext(ff) AND do_more(nonstop,COL_CYAN));
  76.     filefindclose(ff);
  77.   }
  78.   if(file_index = 0)
  79.   {
  80.     print(str_stv_no_files);
  81.     menu_cmd(106,"");
  82.     return 0;
  83.   }
  84.   print(str_stv_see_cont);
  85.   input_str(in,INPUT_NLB_LINE,0,3,"");
  86.   in_num := strtoi(in);
  87.   if(in_num <> 0)
  88.   {
  89.     print(AVATAR_CLS);
  90.     display_file(work_path+"\\"+arc_fname[in_num],nonstop);
  91.     see_more := input_list("YN",0,"","",str_stv_see_another);
  92.     if(see_more = 'y' OR see_more = 'Y')
  93.       return 1;
  94.   }
  95.   return 0;
  96. }
  97.  
  98.  
  99.  
  100. void main()
  101. {
  102.   int: ok;
  103.   char: ch;
  104.   string: fname, work_path;
  105.  
  106.   init_lang_starview();
  107.  
  108.   work_path := STARVIEW_PATH+"temp"+this_task;
  109.  
  110.   print(AVATAR_CLS+COL_LBLUE+strpad("",79,'─')+"\n");
  111.   print(COL_YELLOWONBLUE+str_stv_header);
  112.   print(COL_LBLUE+strpad("",79,'─')+"\n");
  113.   print(str_stv_getfname);
  114.   input_str(fname,INPUT_WORD,0,14,"");
  115.   cleanup();
  116.   if(fileexists(farea.downpath+fname)=False)
  117.   {
  118.     print(str_stv_not_found);
  119.     menu_cmd(106,"");
  120.     return;
  121.   }
  122.   do_unpack(fname,work_path);
  123.   while(get_txt(fname,work_path)=1);
  124.   cleanup();
  125.   print(AVATAR_CLS+str_stv_tag_file+strupper(fname)+str_stv_tag_end);
  126.   ch := getch();
  127.   if(ch = 'Y' or ch = 'y')
  128.   {
  129.     input := "A;"+fname;
  130.     menu_cmd(512,"");
  131.   }
  132.   print("\n");
  133.   menu_cmd(106,"");
  134. }
  135.  
  136.  
  137.